home *** CD-ROM | disk | FTP | other *** search
/ Clickx 115 / Clickx 115.iso / software / tools / windows / tails-i386-0.16.iso / live / filesystem.squashfs / var / lib / dpkg / info / netbase.postinst < prev    next >
Encoding:
Text File  |  2011-01-19  |  1.7 KB  |  81 lines

  1. #!/bin/sh -e
  2.  
  3. create_hosts_file() {
  4.   if [ -e /etc/hosts ]; then return 0; fi
  5.  
  6.   cat > /etc/hosts <<-EOF
  7.     127.0.0.1    localhost
  8.     ::1        localhost ip6-localhost ip6-loopback
  9.     fe00::0        ip6-localnet
  10.     ff00::0        ip6-mcastprefix
  11.     ff02::1        ip6-allnodes
  12.     ff02::2        ip6-allrouters
  13.  
  14. EOF
  15. }
  16.  
  17. create_networks_file() {
  18.   if [ -e /etc/networks ]; then return 0; fi
  19.  
  20.   cat > /etc/networks <<-EOF
  21.     default        0.0.0.0
  22.     loopback    127.0.0.0
  23.     link-local    169.254.0.0
  24.  
  25. EOF
  26. }
  27.  
  28. update_rc() {
  29.   if [ -x /etc/init.d/networking ]; then
  30.     update-rc.d networking start 40 S . start 35 0 6 . > /dev/null
  31.   fi
  32. }
  33.  
  34. # create bindv6only.conf on new installs and upgrades from << 4.38
  35. create_bindv6only_conf() {
  36.   if [ -e /etc/sysctl.d/bindv6only.conf ]; then
  37.     return 0
  38.   fi
  39.   [ "$(uname -s)" = "Linux" ] || return 0
  40.   [ -d /etc/sysctl.d/ ] || mkdir /etc/sysctl.d/
  41.   if [ "$2" ] && dpkg --compare-versions "$2" ge "4.38"; then
  42.     return 0
  43.   fi
  44.  
  45.   cat >> /etc/sysctl.d/bindv6only.conf <<-EOF
  46. # This sysctl sets the default value of the IPV6_V6ONLY socket option.
  47. #
  48. # When disabled, IPv6 sockets will also be able to send and receive IPv4
  49. # traffic with addresses in the form ::ffff:192.0.2.1 and daemons listening
  50. # on IPv6 sockets will also accept IPv4 connections.
  51. #
  52. # When IPV6_V6ONLY is enabled, daemons interested in both IPv4 and IPv6
  53. # connections must open two listening sockets.
  54. # This is the default behaviour of almost all modern operating systems.
  55.  
  56. net.ipv6.bindv6only = 1
  57. EOF
  58. }
  59.  
  60. case "$1" in
  61.     configure)
  62.     if [ -z "$2" ]; then
  63.     create_hosts_file
  64.     create_networks_file
  65.     fi
  66.     update_rc
  67.     #create_bindv6only_conf "$@"
  68.     ;;
  69.  
  70.     abort-upgrade|abort-remove|abort-deconfigure)
  71.     ;;
  72.  
  73.     *)
  74.     echo "postinst called with unknown argument '$1'" >&2
  75.     exit 1
  76.     ;;
  77. esac
  78.  
  79.  
  80.  
  81.